<template>
    <div>
        <span>最近登陆安全日志</span>
        <myTable :has-pagination="true" :has-border="true" :table-data="tableList" :table-column-options="tableColumnOptions">
            <template #loginTime="{data}">
                <span>{{(data.loginTime+'').slice(0,10)}}</span>
            </template>
        </myTable>
    </div>
</template>

<script>
import { A_getLoginHistory } from "@/api/user/securityLog";
import myTable from "@/components/myTable.vue";
export default {
    name: 'securityLog',
    mounted() {
        this.getLoginHistory()
    },
    components:{
        myTable
    },
    data() {
        return {
            tableList: [],
            tableColumnOptions:[
                {
                    label:'用户名',
                    prop:'userId',
                    width:'300'
                },
                {
                    label:'登陆时间',
                    isSlot:true,
                    slotName:'loginTime',
                    prop:'loginTime',
                    width:'300'
                },
                {
                    label:'ip地址',
                    prop:'ipAddress',
                    width:'300'
                },
            ]
        }
    },
    methods: {
        async getLoginHistory() {
            let result = await A_getLoginHistory();
            this.tableList = result
        }
    }
}
</script>

<style></style>